package com.xuxueli.commontdemo.commont.testSocket;


import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetAddress;
import java.net.Socket;
import java.util.Scanner;

public class SocketClientss {

    public static void main(String[] args) throws IOException {

        Scanner scanner = new Scanner(System.in);
        String next = scanner.next();
        Socket socket = new Socket(InetAddress.getLocalHost(), 6688);
        OutputStream outputStream = socket.getOutputStream();
        outputStream.write(next.getBytes());
        InputStream inputStream = socket.getInputStream();
        byte[] bytes = new byte[1024];
        int value = inputStream.read(bytes);
        System.out.println("服务端传来的数据："+new String(bytes,0,value));
        socket.close();
        outputStream.close();
        inputStream.close();
    }
}
